<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/mystyle.css" />
	</head>

	<body>
		<style>
			.mui-media {
				background: #fff;
			}
			
			.opclist-title {
				font-size: 16px;
			}
		</style>

		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">历史上报</h1>
		</header>
		<div class="mui-content" id="list_content">
			<!--登陆记录列表，js动态插入-->
			<p class="mui-margin-sm">只显示当前一个月内上报记录</p>
		</div>

		<script src="../lib/mui/mui.min.js"></script>
		<script src="../js/serviceUrlConfig.js" type="text/javascript"></script>
		<script type="text/javascript">
			(function($, doc) {
				mui.init()
				$.plusReady(function() {
					//获取用户编号
					var selfInfo = plus.webview.currentWebview();
					plus.navigator.setStatusBarStyle('dark');
					var userInfo = selfInfo.param.userInfo;
					var log = [];
					var url = getServletUrl("PatrolServlet");
					$.ajax({
						type: "POST",
						url: url,
						data: {
							commdCode: "getPatrolList",
							userid: userInfo.id
						},
						dataType: "json",
						success: function(data) {
							if(data.type = 1) {
								log = data.tag;
							} else {
								log = [];
							}
							displayHistory(log);
						},
						error: function(xhr, type, errorThrown) {
							mui.alert("服务器连接失败，请联系管理员！", "提示");
						}
					});

					function displayHistory(log) {
						var content = document.getElementById("list_content");
						var ul = document.createElement("ul");
						ul.classList.add("mui-table-view");
						content.appendChild(ul);
//						log=log.reverse();
						for(var i = 0; i < log.length; i++) {
							var li = document.createElement("li");
							li.classList.add("mui-table-view-cell", "mui-media");
							var a = document.createElement("a");
							a.id = log[i].id; //a标签的id设置为日志行的主键id
							a.classList.add("opclist-title");
							var img = document.createElement("img");
							img.classList.add("mui-media-object", "mui-pull-left");
							var div = document.createElement("div");
							div.classList.add("mui-media-body");
							var p = document.createElement("p");
							p.classList.add("mui-ellipsis");
							var p1 = document.createElement("p");
							p1.classList.add("mui-ellipsis");
							var span = document.createElement("span");
							img.src = "../img/clock.svg";
							span.innerText = log[i].submitTime + " ";
							p.innerText = '水表编号: ' +
								log[i].sbbh;
							p1.innerText = '上报内容: ' +
								log[i].content;
							li.appendChild(a);
							a.appendChild(img);
							a.appendChild(div);
							div.appendChild(span);
							div.appendChild(p);
							div.appendChild(p1);
							ul.appendChild(li);
						}

					}

				});
			}(mui, document));
		</script>
	</body>

</html>